/**
 * 加载修改保存图像
 */
#include <iostream>
#include <opencv2/opencv.hpp>
using namespace cv;
using namespace std;

int main() {
  Mat src = imread("../images/2.jpg");
  if (src.empty()) {
    cout << "could not load image.." << endl;
    return -1;
  }
  namedWindow("opencv setup demo", CV_WINDOW_AUTOSIZE);
  imshow("opencv setup demo", src);

  namedWindow("output window", CV_WINDOW_AUTOSIZE);
  Mat output_image1, output_image2, output_image3;
  cvtColor(src, output_image1, CV_BGR2GRAY);
  cvtColor(src, output_image2, CV_BGR2HLS);
  cvtColor(src, output_image3, CV_BGR2HSV);
  imshow("output window", output_image1);
  imwrite("hlstest2.png", output_image2);
  imwrite("hlstest3.jpg", output_image3);
  imwrite("hlstest3.tiff", output_image1);

  waitKey(0);
  return 0;
}